package cz.najman.emdroid.listener;

import cz.najman.emdroid.service.UpdaterService;

public abstract class AbstractOnDataUpdatedListener implements OnDataUpdatedListener {

		
	@Override
	public void onDataUpdated(int statusCode, Class objectClass) {
		switch (statusCode) {
		case UpdaterService.STATUS_RUNNING:
			onRunning(objectClass);
			break;
		case UpdaterService.STATUS_FINISHED:
			onFinished(objectClass);
			break;
		case UpdaterService.STATUS_ERROR:
			onError(objectClass);
		default:
			break;
		}
	}

	@Override
	public void fireDataUpdated(int result, Class objectClass) {
		onDataUpdated(result, objectClass);
	}
	
	protected abstract void onRunning(Class objectId);
	
	protected abstract void onFinished(Class objectId);
	
	protected abstract void onError(Class objectId);

}
